<?php $baseUrl = $this->baseUrl(); ?>
<link rel="stylesheet" href="<?php echo $this->baseUrl(); ?>/themes/default/css/tarefas.css" media="screen" />
<form action="<?php echo $baseUrl; ?>/corporativo/relatorio/tarefas" method="get">
    <fieldset>
        <legend>Projetos</legend>
            <div class="campo">
                <label>Projeto:</label>
                <?php echo $this->formSelect('fk_projeto', $this->fk_projeto, null, $this->aProjetosSelect); ?>
            </div>

            <div class="campo">
                <label>Situação:</label>
                <strong>Ativo</strong>
            </div>
    </fieldset>

    <button type="submit">Filtrar</button>
</form>
</div>
<div>
   <div class="lista-tarefas">
        <div>
            <table>
                <thead>
                    <tr>
                        <th scope="col">Fim</th>
                        <th scope="col">Situação</th>
                        <th scope="col">Tarefa</th>
                        <th scope="col">Cliente</th>
                        <th scope="col">Usuário</th>
                    </tr>
                </thead>

                <tbody>
                <?php
                $i = 0;
                $dateAtual = new DateTime(date('Y-m-d'));
                foreach ($this->rowSetTarefas as $rowTarefa) {
                    $class = ($i++ % 2 == 0) ? '' : ' class="cor"';
                    $dtPrevisaoFim = new DateTime($rowTarefa->dt_previsao_fim);
                    if ($dtPrevisaoFim < $dateAtual) {
                        $class = ' class="tarefa-atrasada"';
                    } elseif ($dateAtual == $dtPrevisaoFim) {
                        $class = ' class="tarefa-alerta"';
                    }
                    $rowProjeto = $this->rowSetProjeto[$rowTarefa->fk_projeto];
                ?>
                    <tr<?php echo $class; ?>>
                        <td><?php echo $this->dateFormat($rowTarefa->dt_previsao_fim); ?></td>
                        <td><?php echo $this->aTarefaSituacoes[$rowTarefa->cs_situacao]; ?></td>
                        <td><a href="<?php echo $baseUrl; ?>/tarefa/tarefa/visualizar/id/<?php echo $rowTarefa->id_tarefa; ?>"><?php echo $rowTarefa->st_nome; ?></a></td>
                        <td><?php echo $rowProjeto->st_nome; ?></td>
                        <td><?php echo $this->aUsuarios[$rowTarefa->fk_usuario]; ?></td>
                    </tr>
                <?php } ?>
                </tbody>
            </table>
        </div>
</div><!-- fim de accordion -->